var command = "";
var start = function() {
    command = prompt("To make a new profile type 'cp', to view a profile type 'view',and to exit type 'exit'. ","Type the command here");
};
start();
var ID = 0;
    var arr = [];
var createProfile = function(name, desc) {
    arr.push(name);
    arr.push(desc);
    ID = ID + 1;
};
var loop = true;
while(loop) {
if (command==="cp") {
    var name = prompt("Type the name of the person.");
    var desc = prompt("Type in extra description about the person");
    createProfile(name, desc);
    alert("The id of the profile is " + ID);
    command = "";
    start();
} else if (command==="view") {
    var id = prompt("ID:","Type ID here.");
    var id2 = id * 2 - 2;
    alert(arr[id2]);
    alert(arr[id2 + 1]);
    command = "";
    start();
} else if (command==="exit") {
    loop = false;
} else {
    alert("Invalid command.");
    command = "";
    start();
}
}